﻿using System.Data.SQLite;
using SimpleOrmCFPC.Apis.Db.Sqlite;
using SimpleOrmCFPC.Core.Dao.Helpers;
using SimpleOrmCFPC.Core.Orm;
using SimpleOrmCFPC.Core.Query.Requests;
using SimpleOrmCFPC.engines.sqlite;

namespace SimpleOrmCFPC
{
    public class OrmFactory
    {
        public static IOrm CreateFromSqlite(SQLiteConnection connection)
        {
            var sqLiteExecutor = new SqLiteDb(connection);
            RealOrm.IDaoFactory daoFactory = new LinqDaoFactory(sqLiteExecutor, new CreateEntityRequestFactory(), new RequestExecutor(sqLiteExecutor));
            return new RealOrm(daoFactory, sqLiteExecutor, new SQLiteTableSchemaProvider(connection));
        }
    }
}